package solutions.leetcode.normal;

import solutions.lib.BaseSolution;

/**
 * @author lizhidong
 * <a href="https://leetcode-cn.com/problems/increasing-triplet-subsequence/">334.递增的三元子序列</a>
 */
public class Solution334 extends BaseSolution {

    public boolean increasingTriplet(int[] nums) {
        int min1 = Integer.MAX_VALUE;
        int min2 = Integer.MAX_VALUE;
        for (int v : nums) {
            if (v > min2) {
                return true;
            }
            if (v == min2) {
                continue;
            }
            if (v > min1) {
                min2 = v;
            } else if (v < min1) {
                min1 = v;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Solution334 solution = new Solution334();
        System.out.println(solution.increasingTriplet(new int[]
                        {1,5,0,4,1,3}
                ));

        int a = 10;
        int b = 20;
        int[] c = new int[] {a, b};
        a = 30;
        printVals(c);
    }
}